{% extends 'base.html.twig' %}
{% block body %}
    {% for product in paginator.results %}
        <p><a href="{{ path('product_detail',{id: product.id }) }}">{{ product.title }}</a></p>
    {% endfor %}
    {% if paginator.hasToPaginate %}
        <div class="navigation text-center">
            <ul class="pagination">
                {% if paginator.hasPreviousPage %}
                    <li class="prev"><a href="{{ path('product_list', {page: paginator.previousPage, type:1}) }}" rel="previous"><i class="fa fw fa-long-arrow-left"></i> {{ 'paginator.previous'|trans }}</a></li>
                {% else %}
                    <li class="prev disabled"><span><i class="fa fw fa-arrow-left"></i> {{ 'paginator.previous'|trans }}</span></li>
                {% endif %}

                {% for i in 1..paginator.lastPage %}
                    {% if i == paginator.currentPage %}
                        <li class="active"><span>{{ i }} <span class="sr-only">{{ 'paginator.current'|trans }}</span></span></li>
                    {% else %}
                        <li><a href="{{ path('product_list', {page: i, type:1}) }}">{{ i }}</a></li>
                    {% endif %}
                {% endfor %}

                {% if paginator.hasNextPage %}
                    <li class="next"><a href="{{ path('product_list', {page: paginator.nextPage, type:1}) }}" rel="next">{{ 'paginator.next'|trans }} <i class="fa fw fa-arrow-right"></i></a></li>
                {% else %}
                    <li class="next disabled"><span>{{ 'paginator.next'|trans }} <i class="fa fw fa-arrow-right"></i></span></li>
                {% endif %}
            </ul>
        </div>
    {% endif %}
{% endblock %}